<?php
  
 /**
  * @package JooS
  * @subpackage Syntax_PHPackager
  */

  require_once "JooS/Syntax/Complex/Transition.php";

  class JooS_Syntax_PHPackager_Relations_By_Version extends JooS_Syntax_Complex_Transition {
    /**
     * @return string
     */
    public function compile() {
      $ret = parent::compile();
      if ($ret !== false) {
        $ret = "\$this->getRelationByVersion('" . implode("','", array(
          $this->getParsedValue(0),
          $this->getParsedValue(2), 
          $this->getParsedValue(4), 
        )) . "')";
      }
      return $ret;
    }

    /**
     * @return JooS_Syntax_Complex_Concatenate
     */
    public function createRule() {
      $parser = $this->getParser();
      
      return $parser->createSyntax("Complex_Concatenate", array(
        $parser->createSyntax("Complex_Concatenate", array(
          $parser->createSyntax("PHPackager_DOM_Name"),
        )), 
        $parser->createSyntax("Common_WhiteSpace"),
        $parser->createSyntax("Complex_Choose", array(
          $parser->createSyntax("Simple_Symbol", "=="),
          $parser->createSyntax("Simple_Symbol", "<="),
          $parser->createSyntax("Simple_Symbol", "<"),
          $parser->createSyntax("Simple_Symbol", ">="),
          $parser->createSyntax("Simple_Symbol", ">"),
        )), 
        $parser->createSyntax("Common_WhiteSpace"),
        $parser->createSyntax("PHPackager_DOM_Version")
      ));
    }
  }
